<?php require_once('../../core/import.php');?>
<?php User::Permission('STATISTICS_ACCOUNT'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <script type="text/javascript" src="../../scripts/import.js"></script>
    <script type="text/javascript" src="../../scripts/components/checkbox/import.checkbox.js"></script>
    <script type="text/javascript" src="../../scripts/components/zebra_table/import.zebra_table.js"></script>
    <SCRIPT src="scripts/setday.js"></SCRIPT> 
<!--    <script type="text/javascript" src="scripts/list.js"></script>-->
</head>

<body>
	<?php
	  #获取数据
	  $Tables=Functions::HttpArgs('id');//表名
	  $Period_Class=Functions::HttpArgs('Period_Class');//days
	  $Period=Functions::HttpArgs('Period');//日期
	  $Cxecution=Functions::HttpArgs('Cxecution');//版块
	  $UserName=Functions::HttpArgs('UserName');//管理员
	  if(!$UserName){ $UserName=User::Session('Username');}
	  $TdField_Third='';
	  //exit($Cxecution);
	?>
    <table width="98.5%" id="List" border="0" cellpadding="0" cellspacing="0" class="List">
    <thead>
    <tr><td colspan="4"> &nbsp;<?php User::Sum_Count($Cxecution,'Cxecution',$Period_Class,$Period,$UserName); ?>
    </td></tr>
    </thead>
    <thead>
    <?php
	  
    	switch($Cxecution)
		{
			case '资讯版块--添加信息':
				$TdField_Third='/admin/modules/news/edit.php';
				break;
			case '专题频道--添加信息':
				$TdField_Third='/admin/modules/topic/edit.php';
				break;
			case '人物访谈--添加信息':
				$TdField_Third='/admin/modules/interview/edit.php';
				break;
			case '企业之窗--添加信息':
				$TdField_Third='/admin/modules/enterprise/edit.php';
				break;
			case '船厂订单--添加信息':
				$TdField_Third='/admin/modules/shipyard/edit.php';
				break;
			case '行业展会--添加信息':
				$TdField_Third='/admin/modules/industry/edit.php';
				break;
			case '展会专题--添加信息':
				$TdField_Third='/admin/modules/exhibition_topic/edit.php';
				break;
			case '会展公司--添加信息':
				$TdField_Third='/admin/modules/exhibition_com/edit.php';
				break;
			case '期刊杂志--期刊添加':
				$TdField_Third='/admin/modules/dm/ejournal.edit.php';
				break;
			case '期刊杂志--杂志添加':
				$TdField_Third='/admin/modules/dm/dm.edit.php';
				break;
			case '期刊杂志--幻灯片添加':
				$TdField_Third='/admin/modules/dm/slide.edit.php';
				break;
			default:
				exit('参数错误');
		}
	?>
    <tr>
      <th width="35%" height="25" align="left" valign="middle">&nbsp;标题</th>
      <?php if($Cxecution=='资讯版块--添加信息'){?><th width="15%" height="25" align="left" valign="middle">&nbsp;文章出处</th><?php } ?>
        <th width="35%" align="left" valign="middle">发布时间</th>
        <th width="15%" align="left" valign="middle"></th>
      </tr>
    <?php
	  switch($Period_Class)
		{
			case 'days':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年%m%月%d%日\') days from statistics';
				break;
			case 'weeks':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年%u%周\') weeks from statistics';
				break;
			case 'months':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年%m%月\') months from statistics';
				break;
			case 'years':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年\') years from statistics';
				break;
			default:
				exit('参数错误');
		}
	  
	  $Wheres=' where UserName=\''.$UserName.'\' and Cxecution=\''.$Cxecution.'\'';
	  $Sqls=$Selects.$Wheres;
	  $Datas=DB::GetRows($Sqls);
	  $Messages='';
	  foreach($Datas as $Rows)
		{
			if($Period==$Rows[$Period_Class]) $Messages=$Messages.$Rows['MessageID'].',';
		}
	  $Messages=rtrim($Messages, ",");
	  if($Cxecution=='资讯版块--添加信息'){
	  	$Orgin_num=DB::GetRows('select count(ID) from '.$Tables.' where ID in ('.$Messages.') and Origin=\'中国船舶配套网\'');
	  }
	  $Data=DB::GetData('select * from '.$Tables.' where ID in ('.$Messages.') order by Datetime desc limit ?,15');
    ?>
    
      
    </thead>    
    <tbody>
    <form id="Form1" name="Form1" method="post" >
    <?php
	if(count($Data['Record'])>0)
	{
     foreach($Data['Record'] as $Row)
	  {
	?>
    <tr>
        <td height="25" align="left" valign="middle">
        &nbsp;&nbsp;<?php echo $Row['Title']?>
        </td>
        <?php if($Cxecution=='资讯版块--添加信息'){?>
        <td height="25" align="left" valign="middle">
        &nbsp;&nbsp;<?php echo $Row['Origin']?>
        </td>
        <?php } ?>
        <td height="25" align="left" valign="middle">&nbsp;
        <?php echo $Row['Datetime']?>
        </td>
        <td height="25" align="left" valign="middle">&nbsp;
        <a href="<?php echo $TdField_Third.'?id='.$Row['ID'].'' ?>">编辑</a>
        </td>
    </tr>
    <?php
        }
	}
	else
	{
		echo '<tr><td align=center colspan=4>该信息已被删除。</td></tr>';
	}
    ?>
    </form>
    </tbody>    
    <tfoot>
    <tr>
        <td height="25" colspan="4" align="center" valign="middle">
            <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td width="55%" align="left">
                <?php
                    PagerFactory::Create('Simple')->Display($Data,array
					 (
			  	 	'Parameters'=>array(
					'id'=>$Tables,
					'Period_Class'=>$Period_Class,
					'Period'=>$Period,
					'Cxecution'=>$Cxecution,
					'UserName'=>$UserName
					 )
					 ));
					 if($Cxecution=='资讯版块--添加信息'){
					 	echo '其中有<font color="red">'. $Orgin_num[0][0].'</font>条信息出自<font color="#CC3300">中国船舶配套网</font>';
					 }
                ?>
                </td>
            </tr>
            </table>    
         </td>
	</tr>
    </tfoot>    
    </table>
</body>
</html>